package com.auto.learning.tools;

import android.app.Dialog;
import android.content.Context;

public class GBSSDialog extends Dialog {
	public Context mContext;
	public Dialog dialog;
	public GBSSDialog(Context context) {
		super(context);
		mContext = context;
		dialog = this;
		
		this.setCancelable(true);
	}

	protected GBSSDialog(Context context, boolean cancelable,
			OnCancelListener cancelListener) {
		super(context, cancelable, cancelListener);
		mContext = context;
		dialog = this;
		this.setCancelable(true);
	}

	public GBSSDialog(Context context, int theme) {
		super(context, theme);
		mContext = context;
		dialog = this;
		this.setCancelable(true);
	}

	/*
	private View getRootView() {
		return ((ViewGroup) findViewById(android.R.id.content)).getChildAt(0);
	}
	
	public void changeFont(ViewGroup view, Typeface typeface) {
		for (int i = 0; i < view.getChildCount(); i++) {
			View view2 = view.getChildAt(i);
			if (view2 instanceof TextView) {
				((TextView) view2).setTypeface(typeface);
			} else if (view2 instanceof Button) {
				((Button) view2).setTypeface(typeface);
			} else if (view2 instanceof EditText) {
				((EditText) view2).setTypeface(typeface);
			} else if (view2 instanceof LinearLayout
					|| view2 instanceof RelativeLayout
					|| view2 instanceof FrameLayout) {
				changeFont((ViewGroup) view2, typeface);
			}
		}
	}
	
	Typeface typeface;
	public Typeface getYuanYouTypeface() {
		if (typeface == null) {
			typeface = Typeface.createFromAsset(mContext.getAssets(), PropertiesUtil.readProperties(mContext, R.raw.common).getString("fontType", ""));
		}
		return typeface;
	}

	*//**
	 * 设置所有字体为幼圆
	 *//*
	public void setAllFont() {
		ViewGroup view = (ViewGroup) getRootView();
		Typeface typeface = getYuanYouTypeface();
		changeFont(view, typeface);
	}*/
}
